<script lang="ts" setup>
const emits = defineEmits<{ clickMe: [] }>();

defineProps<{ text: number }>();

const { DialogDemo } = useBaseDialog();

const dialogDemo = new DialogDemo();

const handleClick = () => {
  console.log("Button clicked!");
  emits("clickMe");
};

const closeAll = () => {
  dialogDemo.destroyAll();
};

const openNew = () => {
  dialogDemo.showDialog();
};
</script>

<template>
  <div v-track:exposure="{ opt_label: 'lcl' }">
    <button @click="handleClick" v-track:click="{ opt_label: '123' }">
      Click me {{ text }}
    </button>
    <button @click="openNew">打开一个新的弹窗</button>
    <button @click="closeAll">关闭所有</button>
    <slot />
  </div>
</template>
